package lhdx15;

import java.util.Scanner;

public class ComputerTest {
    public static void main(String[] args) {
        Computer co = new Computer("华硕", 4999, "黑色", "1024*768", false, false,false, 400000);
        co.purchase();
        Scanner in = new Scanner(System.in);

        while (true) {
            System.out.println("1.启动，2格式化，3.安装操作系统，4.安装软件，5.查看各盘情况，6退出");
            int A = in.nextInt();
            if (A == 1) {
                co.starup1();
            } else if (A == 2) {
                if (co.isStarUp() == true) {
                    System.out.print("计划分成几个盘！");
                    int k = in.nextInt();
                    String[] drive=new String[k];
                    int[] diskSize=new int[k];
                    System.out.println("请输入" +k+ "个盘符名称！！");
                    for (int i = 0; i <k; i++) {
                        drive[i]=in.next();
                    }
                    System.out.println("请输入" + k + "个盘的大小！！");
                    for (int i=0;i<k;i++){
                        diskSize[i]=in.nextInt();
                    }
                    co.formats(drive,diskSize);
                }else {
                    System.out.println("请启动！ ");
                }
            } else if (A == 3) {
                if (co.isStarUp() == true && co.isFormat() == true) {
                    SystemsSoftware ss = new SystemsSoftware();
                    System.out.println("请选择操作系统：win7/win10/win11");
                    ss.setSoftwareBrand(in.next());
                    if (ss.getSoftwareBrand().equals("win7")){
                        System.out.println("请选择安装的盘：");
                        String drive=in.next();
                        System.out.println("请输入软件大小：");
                        ss.setSize(in.nextInt());
                        co.lnstallationSystems(drive,ss);

                    }else if (ss.getSoftwareBrand().equals("win10")){
                        System.out.println("请选择安装的盘：");
                        String drive=in.next();
                        System.out.println("请输入软件大小：");
                        ss.setSize(in.nextInt());
                        co.lnstallationSystems(drive,ss);
                    }else if (ss.getSoftwareBrand().equals("win11")){
                        System.out.println("请选择安装的盘：");
                        String drive=in.next();
                        System.out.println("请输入软件大小：");
                        ss.setSize(in.nextInt());
                        co.lnstallationSystems(drive,ss);
                    }else {
                        System.out.println("系统错误！");
                    }
                } else {
                    System.out.println("请启动或格式化！");
                }
            }else if (A==4){
                if (co.isStarUp()==true&&co.isFormat()==true&&co.isLnstallationSystem()==true) {
                    System.out.println("1.普通软件，2.下载软件。");
                    int k = in.nextInt();
                    if (k == 1) {
                        Software st = new GeneralSoftware();
                        System.out.print("软件名称：");
                        st.setSoftwareBrand(in.next());
                        System.out.print("软件大小：");
                        st.setSize(in.nextInt());
                        System.out.print("安装位置：");
                        String drive = in.next();
                        co.download(drive,st);
                    } else if (k == 2) {
                        Software st = new DownloadASoftware();
                        System.out.print("软件名称：");
                        st.setSoftwareBrand(in.next());
                        System.out.print("软件大小：");
                        st.setSize(in.nextInt());
                        System.out.print("安装位置：");
                        String drive = in.next();
                        co.download(drive,st);
                    }else {
                        System.out.println("安装错误！");
                    }
                }else {
                    System.out.println("操作错误！");
                }
            }else if (A==5){
                if (co.isStarUp()==true&&co.isFormat()==true&&co.isLnstallationSystem()==true) {
                    System.out.println("请选择要查看的盘：");
                    String drive = in.next();
                    co.see(drive);
                }else {
                    System.out.println("操作错误！");
                }
            }else if (A==6){
                break;
            }
        }
    }
}
